<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../component/pear/css/pear.css" />
    <style>

    </style>
</head>

<body>
    <form class="layui-form" action="">
        <div class="mainBox">
            <div class="main-container">
                <div class="main-container">
                  
                    <div class="layui-form-item">
                        <label class="layui-form-label">频道名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入频道名称"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">频道ID</label>
                        <div class="layui-input-block">
                            <input type="text" name="cid" autocomplete="off" disabled="disabled" placeholder="请输入频道ID"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">描述</label>
                        <div class="layui-input-block">
                            <input type="text" name="descText" autocomplete="off" placeholder="请输入描述"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">附加信息</label>
                        <div class="layui-input-block">
                            <input type="text" name="extra" autocomplete="off" placeholder="请输入附加信息"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">所有者</label>
                        <div class="layui-input-block">
                            <input type="text" name="owner" lay-verify="required" autocomplete="off" placeholder="请输入所有者"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">回调地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="callback" autocomplete="off" placeholder="请输入回调地址"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密匙</label>
                        <div class="layui-input-block">
                            <input type="text" name="secret" autocomplete="off" placeholder="请输入密匙"
                                class="layui-input">
                        </div>
                    </div>
      
                    <div class="layui-form-item">
                        <label class="layui-form-label">频道头像</label>
                        <div class="layui-input-block">
                            <input type="text" name="portrait" autocomplete="off" placeholder="请输入频道头像地址"  class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="button-container">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
                    lay-filter="mgclb-save">
                    <i class="layui-icon layui-icon-ok"></i>
                   修改
                </button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>
    <script src="../../component/layui/layui.js"></script>
    <script src="../../component/pear/pear.js"></script>
    <script>
        layui.use(['form', 'jquery'], function () {
            let form = layui.form;
            let $ = layui.jquery;

            form.on('submit(mgclb-save)', function (data) {
                $.ajax({
                    url: '/api/channel/create',
                    data: JSON.stringify(data.field),
                    contentType: 'application/json',
                    dataType: 'json',
                    type: 'post',
                    success: function (result) {
                        if (result.code == 0) {
                            layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                                parent.layui.table.reload('channel-table');
                            });
                        } else {
                            layer.msg(result.msg, { icon: 2, time: 1000 });
                        }
                    }
                })
                return false;
            });
        })
    </script>
    <script>
    </script>
</body>

</html>